#ifndef MPR_H_
#define MPR_H_

#include "recbase.h"
#include "rectype.h"
#include "stdffield.h"
#include <string>
#include <vector>

namespace opsrc {
    namespace stdf {

        class Mpr : public opsrc::stdf::RecBase
        {
        public:
            Mpr(stdf_rec stdfrec,  int reclen, std::ios::pos_type fileRecFirstBytePosition, int orderindex, endian e, char* buf );
            virtual ~Mpr();

            const StdfField<long> getTestNumber() const;
            void setTestNumber(StdfField<long> testnum);

            const StdfField<int> getHeadNumber() const;
            void setHeadNumber(StdfField<int> headnum);

            const StdfField<int> getSiteNumber() const;
            void setSiteNumber(StdfField<int> sitenum);

            const StdfField<vector<bool> > getTestFlag() const;
            void setTestFlag(StdfField<vector<bool> > testflag);

            const StdfField<vector<bool> > getParameterFlag() const;
            void setParameterFlag(StdfField<vector<bool> > parmflag);

            const StdfField<int> getPmrCountIndexes() const;
            void setPmrCountIndexes(StdfField<int> rtnicnt);

            const StdfField<int> getReturnResultsCount() const;
            void setReturnResultCount(StdfField<int> rtnicnt);

            const StdfField<vector<int> > getReturnStatesArray() const;
            void setReturnStatesArray(StdfField<vector<int> > rtnstat);

            const StdfField<vector<float> > getReturnResultsArray() const;
            void setReturnResultsArray(StdfField<vector<float> > rtnrslt);

            const StdfField<string> getTestDescriptiveText() const;
            void setTestDescriptiveText(StdfField<string> testtxt);

            const StdfField<string> getAlarmId() const;
            void setAlarmId(StdfField<string> alrmid);

            const StdfField<vector<bool> > getOptionFlag() const;
            void setOptionFlag(StdfField<vector<bool> > optflag);

            const StdfField<int> getTestResultScale() const;
            void setTestResultScale(StdfField<int> resscal);

            const StdfField<int> getTestLowerLimitScale() const;
            void setTestLowerLimitScale(StdfField<int> llmscal);

            const StdfField<int> getTestUpperLimitScale() const;
            void setTestUpperLimitScale(StdfField<int> hlmscal);

            const StdfField<float> getTestLowerLimitValue() const;
            void setTestLowerLimitValue(StdfField<float> lolimit);

            const StdfField<float> getTestUpperLimitValue() const;
            void setTestUpperLimitValue(StdfField<float> hilimit);

            const StdfField<float> getStartingInValue() const;
            void setStartingInValue(StdfField<float> startin);

            const StdfField<float> getStartingIncrementalValue() const;
            void setStartingIncrementalValue(StdfField<float> incrin);

            const StdfField<vector<unsigned int> > getPmrIndexArray() const;
            void setPmrIndexArray(StdfField<vector<unsigned int> > rtnindx);

            const StdfField<string> getUnits() const;
            void setUnits(StdfField<string> units);

            const StdfField<string> getInputConditionUnits() const;
            void setInputConditionUnits(StdfField<string> unitsin);

            const StdfField<string> getResultFormat() const;
            void setResultFormat(StdfField<string> resfmt);

            const StdfField<string> getLowerLimitFormat() const;
            void setLowerLimitFormat(StdfField<string> llmfmt);

            const StdfField<string> getUpperLimitFormat() const;
            void setUpperLimitFormat(StdfField<string> hlmfmt);

            const StdfField<float> getLowerSpecLimit() const;
            void setLowerSpecLimit(StdfField<float> lospec);

            const StdfField<float> getUpperSpecLimit() const;
            void setUpperSpecLimit(StdfField<float> hispec);

            void readFields(char *buf);

        protected:
            Mpr();

        private:
            endian en;
            StdfField<long> test_num;
            StdfField<int> head_num;
            StdfField<int> site_num;
            StdfField<vector<bool> > test_flag;
            StdfField<vector<bool> > parm_flag;
            StdfField<int> rtn_icnt;
            StdfField<int> rslt_cnt;
            StdfField<vector<int> > rtn_stat;
            StdfField<vector<float> > rtn_rslt;
            StdfField<string> test_txt;
            StdfField<string> alrm_id;
            StdfField<vector<bool> > opt_flag;
            StdfField<int> res_scal;
            StdfField<int> llm_scal;
            StdfField<int> hlm_scal;
            StdfField<float> lo_limit;
            StdfField<float> hi_limit;
            StdfField<float> start_in;
            StdfField<float> incr_in;
            StdfField<vector<unsigned int> > rtn_indx;
            StdfField<string> units;
            StdfField<string> units_in;
            StdfField<string> c_resfmt;
            StdfField<string> c_llmfmt;
            StdfField<string> c_hlmfmt;
            StdfField<float> lo_spec;
            StdfField<float> hi_spec;

            bool decodeFields;
            /*
TEST_NUM U*4 Test number
HEAD_NUM U*1 Test head number
SITE_NUM U*1 Test site number
TEST_FLG B*1 Test flags (fail, alarm, etc.)
PARM_FLG B*1 Parametric test flags (drift, etc.)
RTN_ICNT U*2 Count (j) of PMR indexes See note
RSLT_CNT U*2 Count (k) of returned results See note
RTN_STAT jxN*1 Array of returned states RTN_ICNT = 0
RTN_RSLT kxR*4 Array of returned results RSLT_CNT = 0
TEST_TXT C*n Descriptive text or label length byte = 0
ALARM_ID C*n Name of alarm length byte = 0
OPT_FLAG B*1 Optional data flag See note
RES_SCAL I*1 Test result scaling exponent OPT_FLAG bit 0 = 1
LLM_SCAL I*1 Test low limit scaling exponent OPT_FLAG bit 4 or 6 = 1
HLM_SCAL I*1 Test high limit scaling exponent OPT_FLAG bit 5 or 7 = 1
LO_LIMIT R*4 Test low limit value OPT_FLAG bit 4 or 6 = 1
HI_LIMIT R*4 Test high limit value OPT_FLAG bit 5 or 7 = 1
START_IN R*4 Starting input value (condition) OPT_FLAG bit 1 = 1
INCR_IN R*4 Increment of input condition OPT_FLAG bit 1 = 1
RTN_INDX jxU*2 Array of PMR indexes RTN_ICNT = 0
UNITS C*n Units of returned results length byte = 0
UNITS_IN C*n Input condition units length byte = 0
C_RESFMT C*n ANSI C result format string length byte = 0
C_LLMFMT C*n ANSI C low limit format string length byte = 0
C_HLMFMT C*n ANSI C high limit format string length byte = 0
LO_SPEC R*4 Low specification limit value OPT_FLAG bit 2 = 1
HI_SPEC R*4 High specification limit value OPT_FLAG bit 3 = 1
*/

        };

    }	// namespace stdf
}		// namespace opsrc

#endif /*MPR_H_*/
